import { ActionTree } from 'vuex'
import { RootState } from '../index'

export interface AppState {
  collapsed: boolean // 左侧展开收起
}

const state: AppState = {
  collapsed: false
}

const mutations = {
  TOGGLE_COLLAPSED: (state: AppState) => {
    state.collapsed = !state.collapsed
  }
}

const actions: ActionTree<AppState, RootState> = {
  toggleCollapsed(context) {
    context.commit('TOGGLE_COLLAPSED')
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
